<template>
  <div class="list-1">
    <van-list
      v-model:loading="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <content v-for="(item, index) in arr" :key="index" :item="item"></content>
    </van-list>
  </div>
</template>

<script lang="ts" setup>
import content from './content.vue'
import { listWarningmessage } from '@/services/user'
import { onMounted, ref } from 'vue'
const queryParams = ref({
  pageNum: 1,
  pageSize: 10,
  warningLevel: null,
  themeId: null,
  dxIndexSystemValObject: null,
  handleState: null,
  createTime: null,
  username: null,
  deptCode: null
})

const list = async () => {
  const res = await listWarningmessage(queryParams.value)
  console.log(res, '打应数据')
}
onMounted(async () => {
  try {
    list() // 假设这也是一个异步操作
  } catch (error) {
    // 这里处理任何在上述 async 函数中发生的错误
    console.error('Error during onMounted execution:', error)
    // 进一步的错误处理逻辑，如用户通知、状态更新等
  }
})
const arr = [
  {
    icon: '1',
    name: '数计学院',
    shi: '2023-12-12'
  },
  {
    icon: '2',
    name: '数计学院',
    shi: '2023-12-12'
  },
  {
    icon: '3',
    name: '北京学院',
    shi: '2023-12-12'
  },
  {
    icon: '4',
    name: '数计学院',
    shi: '2023-12-12'
  },
  {
    icon: '5',
    name: '数计学院2',
    shi: '2023-12-12'
  }
]
const loading = ref(false)
const finished = ref(false)

const onLoad = () => {
  // 加载状态结束
  loading.value = false
}
</script>

<style lang="scss" scoped>
.list-1 {
  width: 100%;
  height: 100vh;
  // background: rgb(238, 167, 167);
  padding-top: 50px;
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
}
</style>
